using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.ServiceProcess;
using System.Text;
using System.Threading;
using System.IO;
using System.Windows.Forms;

namespace eTMS.UpdateServerServices
{
    partial class WRLC : ServiceBase
    {
        public WRLC()
        {
            InitializeComponent();
        }
        static WRLC serviceController;
        public static void Main()
        {
            try
            {
                serviceController = new WRLC();
                ServiceBase.Run(serviceController);
            }
            catch (Exception ex)
            {
                File.WriteAllText(Application.StartupPath + "\\errorupdate.txt", ex.ToString());
            }
        }
        //[STAThread]
        //public static void Main()
        //{
        //    serviceController = new WRLC();
        //    serviceController.OnStart(null);
        //    Application.Run(new Form());

        //}

        ServiceEntry server;

        protected override void OnStart(string[] args)
        {

            try
            {
                server = new ServiceEntry();
                server.StartServices();
            }
            catch (Exception ex)
            {
                File.WriteAllText(Application.StartupPath + "\\errorupdate.txt", ex.ToString());
            }
        }


        protected override void OnStop()
        {
            server.CloseServices();
        }
    }
}
